<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org"
 xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" 
 layout:decorate="~{layout/layout_th}">
<head>
<meta charset="utf-8">

<title>后台管理系统</title>

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>

<body>

	<div layout:fragment="content">
	ali qr<form >
	<label>orderid</label>
	<input id="orderid" name="orderid" value=""/>
	<label>money(fen)</label>
	<input id="money" name="money" value=""/>
	<label>good name</label>
	<input id="goodname" name="goods" value=""/>
	<input id="btnsubmit" type="button" value="submit">
	</form>
	<br/>
	
	wx	<form >
	<label>orderid</label>
	<input id="orderid1" name="orderid" value=""/>
	<label>money(fen)</label>
	<input id="money1" name="money" value=""/>
	<label>good name</label>
	<input id="goodname1" name="goods" value=""/>
	<input id="btnsubmit1" type="button" value="submit">
	</form>

	<p>ali h5
		<form action="" id="alih5_form">
	<label>orderid</label>
	<input id="orderid2" name="orderid" value=""/>
	<label>money(fen)</label>
	<input id="money2" name="money" value=""/>
	<label>good name</label>
	<input id="goodname2" name="goodname" value=""/>
	<input id="btnsubmit2" type="button" value="submit">
	</form>
	
	wx	h5<form action="/testpagewxh5" method="post">
	<label>orderid</label>
	<input id="orderid3" name="orderid" value=""/>
	<label>money(fen)</label>
	<input id="money3" name="money" value=""/>
	<label>good name</label>
	<input id="goodname3" name="goodname" value=""/>
	<input id="btnsubmit3" type="submit" value="submit">
	</form>
	
	YL GW<form action="/testgwpage" method="post">
	<label>orderid</label>
	<input id="orderid4" name="orderid" value=""/>
	<label>money(fen)</label>
	<input id="money4" name="money" value=""/>
	<label>good name</label>
	<input id="goodname4" name="goodname" value=""/>
	<input id="gwsubmit" type="submit" value="submit">
	</form>
	<div style="width: 100px;height: 100px">
	<img alt="" src="#" id="qrcode_image"/>
	</div>
	</div>
	<div layout:fragment="footjs" >
	
	<script type="text/javascript" th:src="@{/static/js/layer.js}"></script>
	<script type="text/javascript">
		  jQuery(document).ready(function($){
			  $("#btnsubmit").click(function(){
				$("#qrcode_image").attr("src","#");
				  var params={'orderid':$("#orderid").val(),'goodname':$("#goodname").val(),'money':$("#money").val()};
				  var url="/testpage";
				  axios({
					    method: 'post',
					    url:url,
					    data:params,
					    transformRequest: [function (data) {
				              var ret = '';
				              for (var it in data) {
				                ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
				              }
				              return ret
				            }],
					    headers: {
				              'Content-Type': 'application/x-www-form-urlencoded'
				            }
					}).then(function(res){
					    console.log(res.data);
					    var st="http";
					    if(res.data.substr(0,st.length)==st){
					    	//window.location.href=res.data;
					    	$("#qrcode_image").attr("src","/qrcode?url="+encodeURI(res.data));
					    }else
						document.write(res.data);
					});
			  });
			  
			  $("#btnsubmit1").click(function(){
					// alert("sss error!!!");
					  var params={'orderid':$("#orderid1").val(),'goodname':$("#goodname1").val(),'money':$("#money1").val()};
					  var url="/testpage1";
					  axios({
						    method: 'post',
						    url:url,
						    data:params,
						    transformRequest: [function (data) {
					              var ret = '';
					              for (var it in data) {
					                ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
					              }
					              return ret
					            }],
						    headers: {
					              'Content-Type': 'application/x-www-form-urlencoded'
					            }
						}).then(function(res){
						    console.log(res.data);
							document.write(res.data);
						});
				  });
			  $("#btnsubmit2").click(function(event){
					 //alert("h5 error!!!");
					event.preventDefault();
					 // var params={'orderid':$("#orderid2").val(),'goodname':$("#goodname2").val(),'money':$("#money2").val()};
					 var params=$("#alih5_form").serialize();
					  var url="/testpageh5";
					  $.ajax({
						    method: 'post',
						    url:url,
						    data:params,
						    type:'json',
						    transformRequest: [function (data) {
					              var ret = '';
					              for (var it in data) {
					                ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
					              }
					              return ret
					            }],
						    headers: {
					              'Content-Type': 'application/x-www-form-urlencoded'
					            },
					  		success:function(data){
					  			 var st="http";
					  			 var st1="HTTP";
					  			if(data.substr(0,st.length)==st){
							    	window.location.href=data;
							    }else if(data.substr(0,st1.length)==st1){
							    	window.location.href=data;
							    }else
							   if(data.indexOf("html")>=0 &&data.indexOf("html")<3){
								  $(document.body).append(data);
								  //layer.open({type:1,title:"",content:data});
							   }else
								   $(document.body).append(data);
							}
						});
				  });
			  
			/*  $("#btnsubmit3").click(function(){
					// alert("sss error!!!");
					  var params={orderid:$("#orderid3").val(),goodname:$("#goodname3").val(),money:$("#money3").val()};
					  var url="/testpagewxh5";
					  $.ajax({
						    method: 'post',
						    url:url,
						    data:params,
						    contentType:'application/x-www-form-urlencoded',
						    transformRequest: [function (data) {
					              let ret = ''
					              for (let it in data) {
					                ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
					              }
					              return ret
					            }],
						    headers: {
					              'Content-Type': 'application/x-www-form-urlencoded'
					            },
					  		success:function(data){
					  			 var st="http";
					  			if(data.substr(0,st.length)==st){
							    	window.location.href=data;
							    }else
							   if(data.indexOf("html")>=0 &&data.indexOf("html")<3){
								  $(document.body).append(data);
								  //layer.open({type:1,title:"",content:data});
							   }else
								   $(document.body).append(data);
							}
						});
				  });*/
				  
			  $("#gwsubmit").click(function(){
				  event.preventDefault();
					  var params={orderid:$("#orderid4").val(),goodname:$("#goodname4").val(),money:$("#money4").val()};
					  var url="/testgwpage";
					  $.ajax({
						    method: 'post',
						    url:url,
						    data:params,
						    contentType:'application/x-www-form-urlencoded',
						    transformRequest: [function (data) {
					              let ret = ''
					              for (let it in data) {
					                ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
					              }
					              return ret
					            }],
						    headers: {
					              'Content-Type': 'application/x-www-form-urlencoded'
					            },
					  		success:function(data){
					  			 var st="http";
					  			if(data.substr(0,st.length)==st){
							    	window.location.href=data;
							    }else
							   if(data.indexOf("html")>=0 &&data.indexOf("html")<3){
								  $(document.body).append(data);
								  //layer.open({type:1,title:"",content:data});
							   }else
								   $(document.body).append(data);
							}
						});
				  });
		  });
		</script>
	</div>
</body>

</html>